package com.project.feign.client;

import com.project.common.core.utils.exception.Result;
import com.project.feign.client.impl.SystemServiceClientImpl;
import com.project.feign.vo.CrmUserInfoVO;
import com.project.feign.vo.UserInfoVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * CRM用户feign客户fallback业务处理
 *
 * @Author: wyy
 * @Date: 2020-04-11 17:19
 */
@FeignClient(name = "system-service", fallback = SystemServiceClientImpl.class)
public interface SystemServiceClient {

    /**
     * 保存直播0.1元购CRM用户
     *
     * @param crmUserInfoVo 企业用户VO对象
     * @return
     */
    @PostMapping(value = "/system/auth/crmUserInfo/savePrimeCrmUserInfo")
    Result<CrmUserInfoVO> savePrimeCrmUserInfo(@RequestBody CrmUserInfoVO crmUserInfoVo);

    /**
     * 保存无SC CRM用户
     *
     * @param crmUserInfoVo 企业用户VO对象
     * @return
     */
    @PostMapping(value = "/system/auth/crmUserInfo/saveNoSCCrmUserInfo")
    Result<CrmUserInfoVO> saveNoSCCrmUserInfo(@RequestBody CrmUserInfoVO crmUserInfoVo);

    /**
     * 根据用户ID查询用户信息
     *
     * @param userId 用户ID
     * @return
     */
    @GetMapping(value = "/system/auth/userInfo/getByUserId")
    Result<UserInfoVO> getByUserId(@RequestParam("userId") String  userId);

    /**
     * 根据用户openId查询用户信息
     *
     * @param openId 用户openId
     * @return
     */
    @GetMapping(value = "/system/auth/userInfo/getByOpenId")
    Result<UserInfoVO> getByOpenId(@RequestParam("openId") String  openId);


    /**
     * 修改用户信息
     *
     * @param userInfoVO 用户VO对象
     * @return
     */
    @PostMapping(value = "/system/auth/userInfo/updateUserInfoVo")
    Result updateUserInfo(@RequestBody UserInfoVO userInfoVO);


    /**
     * 根据手机号查询CRM用户
     *
     * @param phone 手机号
     * @return
     */
    @GetMapping(value = "/system/auth/crmUserInfo/getByPhone")
    Result getCrmUserByPhone(@RequestParam("phone") String phone);

    /**
     * 根据手机号查询CRM用户
     *
     * @param userIds 用户Id集合
     * @return
     */
    @PostMapping(value = "/system/auth/userInfo/getByUserIds")
    Result<List<UserInfoVO>> getByUserIds(@RequestBody List<String> userIds);


    /**
     * 根据ID查询用户未阅读系统消息数量
     *
     * @param userId 用户ID
     * @return
     */
    @GetMapping(value = "/system/auth/ApplicationMsg/getNotReadMsg")
    Result<Integer> getNotReadMsg(@RequestParam("userId") String userId);
}
